﻿using CSRedis;
using JT809.PubSub.Abstractions;
using JT809.RedisService.Configs;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text;

namespace JT809.RedisService
{
    public sealed class JT809_GpsPostion_Psuh
    {
        //private readonly JT809RedisConfig JT809RedisConfig;
        private readonly CSRedisClient _cSRedis;

        public JT809_GpsPostion_Psuh(IOptions<JT809RedisConfig> redisConfigAccessor, CSRedisClient cSRedisClient)
        {
            //JT809RedisConfig = redisConfigAccessor.Value;
            _cSRedis = cSRedisClient;
        }

        public async void PushAsync(string msgId, string vno_color, string data)
        {
            var key = $"{msgId}";
            await _cSRedis.SetAsync($"String:{key}:{vno_color}", data);
            await _cSRedis.RPushAsync($"List:{key}", data);
        }
    }
}
